<?php
define('MEMORY_LIMIT_ON',function_exists('memory_get_usage'));
define('IS_CGI',substr(PHP_SAPI, 0,3)=='cgi' ? 1 : 0 );
define('IS_WIN',strstr(PHP_OS, 'WIN') ? 1 : 0 );
define('IS_CLI',PHP_SAPI=='cli'? 1   :   0);

if(!IS_CLI) {
    // 当前文件名
    if(!defined('_PHP_FILE_')) {
        if(IS_CGI) {
            //CGI/FASTCGI模式下
            $_temp  = explode('.php',$_SERVER["PHP_SELF"]);
            define('_PHP_FILE_',  rtrim(str_replace($_SERVER["HTTP_HOST"],'',$_temp[0].'.php'),'/'));
        }else {
            define('_PHP_FILE_',    rtrim($_SERVER["SCRIPT_NAME"],'/'));
        }
    }
    if(!defined('__ROOT__')) {
        // 网站URL根目录
        if( strtoupper(APP_NAME) == strtoupper(basename(dirname(_PHP_FILE_))) ) {
            $_root = dirname(dirname(_PHP_FILE_));
        }else {
            $_root = dirname(_PHP_FILE_);
        }
        define('__ROOT__',   (($_root=='/' || $_root=='\\')?'':$_root));
    }

}

/*$php_path = explode("Public",__ROOT__);
$php_url  = explode("Public",$_SERVER['PHP_SELF']);

//文件保存目录路径
echo $save_path = $_SERVER['DOCUMENT_ROOT'].$php_path[0]."Data/kindeditor/uploads/".date("Y")."/".date("m")."/".date("d");
//文件保存目录URL
echo "<br>";
echo $save_url = "http://localhost".$php_url[0]."Data/kindeditor/uploads/".date("Y")."/".date("m")."/".date("d");
//定义允许上传的文件扩展名*/
?>
